
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Spring WebFlux 和 Spring MVC 的区别？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Spring WebFlux 和 Spring MVC 的区别？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Spring MVC 和 Spring WebFlux 在处理请求的编程模型上有何根本区别？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring MVC 基于传统的阻塞式、同步I/O模型，服务器会为每个请求分配一个线程，该线程在处理期间会被占用。而Spring WebFlux 基于非阻塞式、异步I/O模型，它采用事件驱动方式处理请求，线程在等待I/O操作时不会被阻塞，从而提高了系统吞吐量。</div>
          </div>
          <div class="card-source">来源: 1. 编程模型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Spring MVC 和 Spring WebFlux 分别依赖于哪种核心API，并通常运行在哪些服务器上？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring MVC 基于 Servlet API，运行在传统的 Servlet 容器（如 Tomcat、Jetty）中。Spring WebFlux 基于 Reactive API，支持响应式流（Reactive Streams），可以运行在支持反应式编程的服务器（如 Netty、Undertow）上，也可以在传统 Servlet 容器中运行。</div>
          </div>
          <div class="card-source">来源: 2. 运行时支持</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">根据文档，Spring WebFlux 特别适用于哪些应用场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring WebFlux 适用于高并发、低延迟的应用场景，特别是在需要处理大量并发请求和异步 I/O 操作的场景下，例如实时数据流、聊天应用、在线游戏等。</div>
          </div>
          <div class="card-source">来源: 3. 适用场景</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">为什么说Spring WebFlux在性能和扩展性方面优于Spring MVC？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为Spring WebFlux采用非阻塞和异步的特性，能够更高效地处理大量并发请求，减少了线程开销。相比之下，Spring MVC的性能和扩展性受到传统阻塞I/O模型的限制，在高并发时可能需要大量线程和资源。</div>
          </div>
          <div class="card-source">来源: 5. 性能和扩展性</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在响应式编程模型中，Spring WebFlux 使用了哪两种核心类型来处理异步数据流？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring WebFlux 使用 `Mono` 和 `Flux` 类型来处理响应式数据流。</div>
          </div>
          <div class="card-source">来源: 4. 编程模型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Spring MVC的同步阻塞模型在处理高并发请求时会带来什么问题？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在同步阻塞模型下，线程在等待I/O操作完成时会被阻塞。在高并发情况下，这可能导致大量的线程开销和资源占用，因为每个请求都需要一个独立的线程来处理，直到操作完成。</div>
          </div>
          <div class="card-source">来源: 1. 编程模型</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
